package com.qf.commons.web.config;

import com.qf.commons.web.aspect.LogAdviceAspect;

import com.qf.commons.web.exception.GlobalExceptionHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@Configuration
@ComponentScan("com.qf.commons.web.exception.handler")
public class WebAutoConfiguration {

    /**
     * 注册统一异常处理器
     * @return
     */
    @Bean
    public GlobalExceptionHandler getGloablExceptionHandler(){
        return new GlobalExceptionHandler();
    }

    /**
     * 日志增强的切面 - 拦截所有的Controller方法
     * @return
     */
    @Bean
    public LogAdviceAspect getLogAdviceAspect(){
        return new LogAdviceAspect();
    }
}
